<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<%@ page import="com.colabo.j2ee.web.oaf.monitorperspective.action.UserMonitorViewAction" 
%>
<%
	UserMonitorViewAction action = new UserMonitorViewAction();
	String onlineUsers = action.loadOnlineUsers();
	
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>User Monitor View</title>
<script type="text/javascript">

    function onGridSelect(evt){
        var str = 'row: ' + evt.row + ' indices: ' + evt.indices;
        str += ' id: ' + evt.target.getDataByRow(evt.row).id;
        alert(str);
    }

    function gridButtonClick(button, grid){
        alert(button);
    }

    var cmu = [{
        header: '操作员用户名',
        dataIndex: 'opCode',
        dataType: 'string',
        width: 100
    },
    {
        header: '操作员名称',
        dataIndex: 'opName',
        dataType: 'string',
        width: 100
    },
    {
        header: '所属单位',
        dataIndex: 'opUnit',
        dataType: 'string',
        width: 100
    },
    {
        header: 'IP地址',
        dataIndex: 'ipAddr',
        dataType: 'string',
        width: 100
    },
	{
    	header: '登录时间',
        dataIndex: 'logTime',
        dataType: 'string',
        width: 200
    },
    {
        header: '在线时间',
        dataIndex: 'onTime',
        dataType: 'string',
        width: 200
    }
    ]; 

    // using 'load' instead of 'domready' for IE8 
	    var datagrid = new omniGrid('onlineUserGrid', {
	        columnModel: cmu,
	        data: <%=onlineUsers%>,
	        perPageOptions: [10, 20, 50, 100, 200],
	        perPage: 10,
	        page: 1,
	        pagination: true,
	        serverSort: true,
	        showHeader: true,
	        alternaterows: true,
	        showHeader: true,
	        sortHeader: false,
	        resizeColumns: true,
	        multipleSelection: false,
	        width: 900,
	        height: 295
	    });
    	datagrid.addEvent('click', onGridSelect);

</script>
</head>
<body>
<div id="onlineUserGrid" ></div>
</body>
</html>